package com.xd.config.swagger;//package com.xd.archman.config.swagger;
//
//import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
//import io.swagger.annotations.ApiOperation;
//import lombok.RequiredArgsConstructor;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.builders.RequestParameterBuilder;
//import springfox.documentation.oas.annotations.EnableOpenApi;
//import springfox.documentation.schema.ScalarType;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.service.Contact;
//import springfox.documentation.service.ParameterType;
//import springfox.documentation.service.RequestParameter;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * swagger config for open api.
// *
// * @author pdai
// */
//@Configuration
//@EnableOpenApi
//@RequiredArgsConstructor
//public class OpenApiConfig {
//
//    /**
//     * open api extension by knife4j.
//     */
//    private final OpenApiExtensionResolver openApiExtensionResolver;
//
//
//    /**
//     * @return swagger config
//     */
//    @Bean
//    public Docket openApi() {
//        String groupName = "Test Group";
//        return new Docket(DocumentationType.OAS_30)
//                .groupName(groupName)
//                .apiInfo(apiInfo())
//                .select()
//                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
//                .paths(PathSelectors.any())
//                .build()
////                .globalRequestParameters(getGlobalRequestParameters())
////                .globalResponses(HttpMethod.GET, getGlobalResponse())
//                .extensions(openApiExtensionResolver.buildExtensions(groupName))
//                .extensions(openApiExtensionResolver.buildSettingExtensions());
//    }
//
//
//    /**
//     * @return global request parameters
//     */
//    private List<RequestParameter> getGlobalRequestParameters() {
//        List<RequestParameter> parameters = new ArrayList<>();
//        parameters.add(new RequestParameterBuilder()
//                .name("AppKey")
//                .description("App Key")
//                .required(false)
//                .in(ParameterType.QUERY)
//                .query(q -> q.model(m -> m.scalarModel(ScalarType.STRING)))
//                .required(false)
//                .build());
//        return parameters;
//    }
//
//    /**
//     * @return api info
//     */
//    private ApiInfo apiInfo() {
//        return new ApiInfoBuilder()
//                .title("ArchMan Api")
//                .description("xd个人项目api文档")
//                .contact(new Contact("xd", "http://localhost:9393/", "245375716@qq.com"))
//                .termsOfServiceUrl("xdskr.cn")
//                .version("1.0")
//                .build();
//    }
//}
